.TH strftime 3 "" "" ""
.SH SYNOPSIS
strftime \- flexible calendar time formatter
.SH ANSI_SYNOPSIS
#include <time.h>
.br
size_t strftime(char *
.IR s ,
size_t 
.IR maxsize ,
.br
const char *
.IR format ,
const struct tm *
.IR timp );
.br
.SH TRAD_SYNOPSIS
#include <time.h>
.br
size_t strftime(
.IR s ,
.IR maxsize ,
.IR format ,
.IR timp )
.br
char *
.IR s ;
.br
size_t 
.IR maxsize ;
.br
char *
.IR format ;
.br
struct tm *
.IR timp ;
.br
.SH DESCRIPTION
.BR strftime 
converts a 
.BR struct tm 
representation of the time (at
.IR timp )
into a string, starting at 
.IR s 
and occupying no more than
.IR maxsize 
characters.

You control the format of the output using the string at 
.IR format .
.BR *<[format >>
can contain two kinds of specifications: text to be
copied literally into the formatted string, and time conversion
specifications. Time conversion specifications are two-character
sequences beginning with `
.BR % '
(use `
.BR %% '
to include a percent
sign in the output). Each defined conversion specification selects a
field of calendar time data from 
.BR *<[timp >>,
and converts it to a
string in one of the following ways:

o+
o %a
An abbreviation for the day of the week.

o %A
The full name for the day of the week.

o %b
An abbreviation for the month name.

o %B
The full name of the month.

o %c
A string representing the complete date and time, in the form
. Mon Apr 01 13:13:13 1992

o %d
The day of the month, formatted with two digits.

o %H
The hour (on a 24-hour clock), formatted with two digits.

o %I
The hour (on a 12-hour clock), formatted with two digits.

o %j
The count of days in the year, formatted with three digits
(from `
.BR 001 '
to `
.BR 366 ').

o %m
The month number, formatted with two digits.

o %M
The minute, formatted with two digits.

o %p
Either `
.BR AM '
or `
.BR PM '
as appropriate.

o %S
The second, formatted with two digits.

o %U
The week number, formatted with two digits (from `
.BR 00 '
to `
.BR 53 ';
week number 1 is taken as beginning with the first Sunday in a year).
See also 
.BR %W .

o %w
A single digit representing the day of the week: Sunday is day 
.BR 0 .

o %W
Another version of the week number: like `
.BR %U ',
but counting week 1
as beginning with the first Monday in a year.

o
o %x
A string representing the complete date, in a format like
. Mon Apr 01 1992

o %X
A string representing the full time of day (hours, minutes, and
seconds), in a format like
. 13:13:13

o %y
The last two digits of the year.

o %Y
The full year, formatted with four digits to include the century.

o %Z
Defined by ANSI C as eliciting the time zone if available; it is not
available in this implementation (which accepts `
.BR %Z '
but generates
no output for it).

o %%
A single character, `
.BR % '.
o-
.SH RETURNS
When the formatted time takes up no more than 
.IR maxsize 
characters,
the result is the length of the formatted string. Otherwise, if the
formatting operation was abandoned due to lack of room, the result is
.BR 0 ,
and the string starting at 
.IR s 
corresponds to just those
parts of 
.BR *<[format >>
that could be completely filled in within the
.IR maxsize 
limit.
.SH PORTABILITY
ANSI C requires 
.BR strftime ,
but does not specify the contents of
.BR *<[s >>
when the formatted string would require more than
.IR maxsize 
characters.

.BR strftime 
requires no supporting OS subroutines.
.SH SOURCE
src/newlib/libc/time/strftime.c
